package com.example.word_book.bean;

import java.util.Arrays;

public class Word {
    private int id;
    private String word;
    private String type[];

    public String[] getType() {
        return type;
    }

    public void setType(String[] type) {
        this.type = type;
    }

    public String[] getTranslation() {
        return translation;
    }

    public void setTranslation(String[] translation) {
        this.translation = translation;
    }

    private String translation[];
    private int heat;

    public Word(int id, String word, String type, String translation, int heat) {
        this.id = id;
        this.word = word;
        this.type = new String[]{type};
        this.translation = new String[]{translation};
        this.heat = heat;
    }

    public Word(String word, String type, String translation) {
        this.word = word;
        this.type = new String[]{type};
        this.translation = new String[]{translation};
        this.heat = 0;
    }

    public Word(int id, String word, int heat) {
        this.id = id;
        this.word = word;
        this.heat = heat;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Word(int id, String word, String[] type, String[] translation, int heat) {
        this.id = id;
        this.word = word;
        this.type = type;
        this.translation = translation;
        this.heat = heat;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }


    public int getHeat() {
        return heat;
    }

    public void setHeat(int heat) {
        this.heat = heat;
    }

    public void addTranslation(String s) {
        String[] ss = this.translation;
        this.translation = new String[ss.length + 1];
        int i = 0;
        for (; i < ss.length; i++) {
            this.translation[i] = ss[i];
        }
        this.translation[i] = s;
    }

    public void addType(String s) {
        String[] ss = this.type;
        this.type = new String[ss.length + 1];
        int i = 0;
        for (; i < ss.length; i++) {
            this.type[i] = ss[i];
        }
        this.type[i] = s;
    }

}
